<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix='c' uri='http://java.sun.com/jstl/core_rt'%>
<%@taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@ page
	import="org.springframework.security.core.AuthenticationException"%>
		<%@ page import="java.net.URL" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Home</title>

<link rel="stylesheet" type="text/css"
	href=${pageContext.servletContext.contextPath}/static/css/start-style.css />

<link rel="stylesheet" type="text/css"
	href=${pageContext.servletContext.contextPath}/static/css/jquery-ui-1.8.14.custom.css />

<script type="text/javascript"
	src=${pageContext.servletContext.contextPath}/static/javascript/jquery-1.6.2.min.js></script>
<script type="text/javascript"
	src=${pageContext.servletContext.contextPath}/static/javascript/jquery-1.6.2.min.js></script>
<script type="text/javascript"
	src=${pageContext.servletContext.contextPath}/static/javascript/jquery-ui-1.8.16.custom.min.js></script>
<script type="text/javascript"
	src=${pageContext.servletContext.contextPath}/static/javascript/jquery.validate-1.5.5.min.js></script>


<script>

	
	$(function() {
		$.datepicker.setDefaults({dateFormat: 'dd/mm/yy', firstDay: 1, minDate: 0, changeMonth: true, changeYear: true, showOtherMonths: true, showOtherYears: true});
			$('#rentDateFrom').datepicker({onSelect: function() {
			            $('#rentDateTo').datepicker('option', {minDate: $(this).datepicker('getDate')});
			      }});
			$('#rentDateTo').datepicker({onSelect: function() {

			            $('#rentDateFrom').datepicker('option', {maxDate: $(this).datepicker('getDate')});

			      }});
	});
	
	function submitForm(){
		var startdate = Date.parse($("#rentDateFrom ").val());
		var enddate = Date.parse($("#rentDateTo ").val());
		if (!startdate) {
			 document.getElementById('dateFromMessage').innerHTML = " prosze uzupelnic";
			 document.getElementById('rentDateFrom').style.borderColor='#FE2E2E';
		} else {
			document.getElementById('dateFromMessage').innerHTML = "";
			 document.getElementById('rentDateFrom').style.borderColor='#000000';
		}
		if (!enddate) {
			 document.getElementById('dateToMessage').innerHTML = " prosze uzupelnic";
			 document.getElementById('rentDateTo').style.borderColor='#FE2E2E';
		} else {
			document.getElementById('dateToMessage').innerHTML = "";
			 document.getElementById('rentDateTo').style.borderColor='#000000';
		}
		
		if (!startdate || !enddate)
			return false;
		else 
			return true;
	}
	
	</script>

<title>Wypozyczalnia samochodow</title>
</head>
  <body> 
    <div id="wrapper">
      <div id="bg"> 
        <div id="header"></div>  
        <div id="page">
        	<jsp:include page="header.jsp"/>
            <!--  content -->  
            <div id="content"> 
            
              <div id="center">
              	
                <div id="main_content">
                <div id="listasamochodow1">
                	<h3>Wybrany samochód</h3>
	                <table>
			                <tr>
			                	<th>Producent</td><td>${recentlyRentedCar.brand}</td>
			                	<th>Model</td><td>${recentlyRentedCar.model}</td>
			                	
			                </tr>
			                <tr>
			                	<th>Rok produkcji</td><td>${recentlyRentedCar.year}</td>
			                	<th>Numer rejestracyjny</td><td>${recentlyRentedCar.registration_number}</td>
			                </tr>
			                <tr>
			                	<th>Kolor</td><td>${recentlyRentedCar.color}</td>
			                	<th>Opis</td><td>${recentlyRentedCar.description}</td>
			                </tr>
		                </table>
					
					<form:form class="cmxform" commandName="rentForm" id="rentForm" method="post" action="/ssi/rent/rent.do">
							<p>Rozpoczecie wypozyczenia: <input id="rentDateFrom" name="rentDateFrom" type="text" readonly="true"><label id="dateFromMessage" style="color: red"></label><br />
							   Zakonczenia wypozyczenia: <input id="rentDateTo" name="rentDateTo" type="text" readonly="true"><label id="dateToMessage" style="color: red"></label>
							</p>
							<br />
							Czy na pewno złożyć rezerwacje na wypożyczenie samochodu?<br />
	 	                	<input id="id" type="hidden" path="id" name="id" value="${recentlyRentedCar.id}" />
	 	                	<input id="submit" type="submit" path="choice" name="choice" value="TAK" onclick="return submitForm();" />
	 	                	<input id="submit" type="submit" path="choice" name="choice" value="NIE"/>
		            </form:form>
		            
		            
				</div>
              </div>  
              </div>  
              
              <div id="right"> 
		        	<jsp:include page="sidebar.jsp"/>
              </div>
              <div class="clear" style="height:40px"></div> 
            </div>  
            <!-- end content --> 
          </div>  
          <!-- end container --> 
        </div>  
        <div id="footerWrapper"> 
          <div id="footer"> 
            <p style="padding-top:10px;"> 
              <a href="#" shape="rect">Home</a> | 
              <a href="#" shape="rect">Products</a> | 
              <a href="#" shape="rect">Services</a> | 
              <a href="#" shape="rect">News</a> | 
              <a href="#" shape="rect">About</a> 
            </p>  
            <p> 
              <!-- 
DO NOT REMOVE OR MODIFY THE FOOTER LINK BELOW.
If you want to remove this link please make a 10 dollars donation at www.dotemplate.com
-->  
              <a href="http://www.dotemplate.com" shape="rect">Templates</a> maker
            </p> 
          </div> 
        </div> 
      </div> 
    </div>
  </body>
</html>
